import request from "@/libs/request";

const basePath = '/appcloud-portal' ;

export const apiUrls = {
  deleteUserById : basePath + '/user/deleteUserById/',
  getTokenInfo : basePath + '/user/getTokenInfo/',
  getUserInfoById : basePath + '/user/getUserInfoById/',
  getUserList : basePath + '/user/getUserList',
  logout : basePath + '/user/logout/',
  saveUser : basePath + '/user/saveUser',
  updatePassword : basePath + '/user/updatePassword',
  updateUser : basePath + '/user/updateUser',
}

//删除用户
export async function deleteUserById(id){
	return request( apiUrls.deleteUserById + id,{
      method:'POST',
  })
}


// 通过token获取信息
export async function getTokenInfo(token){
	return request( apiUrls.getTokenInfo + token)
}

// 获取用户信息
export async function getUserInfoById(userId){
	return request( apiUrls.getUserInfoById + userId)
}

//获取用户列表
export async function getUserList(params){
	return request( apiUrls.getUserList, {
      method:'POST',
      body:params
  })
}


//退出登录
export async function logout(token){
	return request( apiUrls.logout + token)
}

//保存用户
export async function saveUser(params){
	return request( apiUrls.saveUser, {
      method:'POST',
      body:params
  })
}

//重置密码
export async function updatePassword(params){
	return request( apiUrls.updatePassword, {
      method:'POST',
      body:params
  })
}


//更新用户信息
export async function updateUser(params){
	return request( apiUrls.updateUser, {
      method:'POST',
      body:params
  })
}